#include "StdAfx.h"

Material::Material(MaterialDesc &desc):GameResource(desc)
{
	DiffuseMap=_RESC(desc.DiffuseMapName);
	NormalMap=_RESC(desc.NormalMapName);
	SpecularMap=_RESC(desc.SpecularMapName);
	SpecularColor=Vec3(1,1,1);
	Shininess=1;
}
Material::~Material(void)
{
}
void Material::LoadFromFile()
{
	Reader reader(FileName);
	DiffuseMap=reader.GetResc("DIFFUSE_MAP");
	NormalMap=reader.GetResc("NORMAL_MAP");
	SpecularMap=reader.GetResc("SPECULAR_MAP");
	if(reader.JumpAfterNext("SPECULAR_COLOR"))
		SpecularColor=reader.GetVec3();
	else SpecularColor=Vec3(1,1,1);
	if(reader.JumpAfterNext("SHININESS"))
		Shininess=reader.GetReal();
	else Shininess=10;
}
void Material::SaveToFile()
{
}
